package com.wyd.sort;

public class SelectionSort implements SortInterface{
    @Override
    public int[] sort(int[] sorts) {
        int min = 0;
        for (int i = 0; i < sorts.length; i++) {
            min = i;
            for (int j = i+1; j < sorts.length; j++) {
                if (sorts[min] > sorts[j]){
                    min = j;
                }
            }
            if (min != i){
                int temp = sorts[i];
                sorts[i] = sorts[min];
                sorts[min] = temp;
            }
        }
        return sorts;
    }
}
